package com.lzs.collection.Set;

import lombok.Data;

import java.sql.SQLOutput;
import java.util.HashSet;

@SuppressWarnings("all")
public class HashSetIncrement {
    public static void main(String[] args) {
        HashSet hashSet = new HashSet();
        //在table表的某一条链表上添加7个A对象
        for (int i = 0; i <= 7; i++) {
            hashSet.add(new A(i));
        }
        //在table表的另一条链表上添加7个对象B
        for (int i = 0; i <= 7; i++) {
            hashSet.add(new B(i));
        }
        System.out.println(hashSet);
    }
}

class A {
    private int n;
    public A(int n) {
        this.n = n;
    }
    @Override
    public int hashCode() {
        return 100;
    }
}

class B {
    private int n;
    public B(int n) {
        this.n = n;
    }
    @Override
    public int hashCode(){
        return 200;
    }
}